package kioschool.view.controlsimpl
{
	import flash.display.DisplayObject;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;
	
	import kioschool.controller.PrimaryController;
	import kioschool.util.StringUtils;
	import kioschool.view.controls.ICommentPanel;
	
	import mx.utils.StringUtil;

	
	/**
	 * Панель с комментариями 
	 * 
	 * @author Akimushkin Vasiliy
	 */ 
	public class DefaultCommentPanel implements ICommentPanel
	{
		/**
		 * Дефолтное представление - текстовое поле
		 */ 
		private var view:TextField = new TextField();
		
		/**
		 * Конструктор, инициализирует слушателей кнопок смены режимов
		 */ 
		public function DefaultCommentPanel(){
			view.autoSize = TextFieldAutoSize.NONE;
			view.multiline=true;
			view.selectable=false;
		}
		
		
		
		public function set greeting(comment:String):void{
			var s:Number = view.parent.scaleX;
			var size:int = s<1?12*s:12;
			var textFormat : TextFormat = new TextFormat ("Tahoma", size, 0x333333);
			//textFormat.bold = true;
			
			view.text=StringUtils.toMultiline(comment, s<1?200*s-6:200, textFormat);
			view.setTextFormat(textFormat);
		}
		
		public function set comment(comment:String):void{
			var s:Number = view.parent.scaleX;
			var size:int = s<1?12*s:12;
			var textFormat : TextFormat = new TextFormat ("Tahoma", size, 0x333333);
			//textFormat.bold = true;
			
			view.text=StringUtils.toMultiline(comment, s<1?200*s-6:200, textFormat);
			view.setTextFormat(textFormat);
		}
		
		public function set error(comment:String):void{
			var s:Number = view.parent.scaleX;
			var size:int = s<1?12*s:12;
			var textFormat : TextFormat = new TextFormat ("Tahoma", size, 0x990000);
			//textFormat.bold = true;
			
			view.text=StringUtils.toMultiline(comment, s<1?200*s-6:200, textFormat);
			view.setTextFormat(textFormat);
		}
		
				
		public function getView():DisplayObject{
			return view;
		}
	}
}